% derive the impact on the d.m1  (i.e., delta log release)

clc;
clear all;
close all;

load addYearSpecificSpillover;
Newmatrix = addYearSpecificSpillover;
[row, col] = size(addYearSpecificSpillover);
Newmatrix(:, (col+1)) = 0;


col_part2 = 85;
col_intraspillover2 = 87;
col_interspillover1992 = 97;
col_interspillover1993 = 99;
col_interspillover1994 = 101;
col_interspillover1995 = 103;
col_interspillover1996 = 105;



% estimated coefficients from STATA

a = [
-0.3478014
-0.3167033
-4.01149
-2.607876
-3.722103
-1.415501
-2.306946
];

partcoeff = a(1);
intracoeff = a(2);
inter1992= a(3);
inter1993= a(4);
inter1994= a(5);
inter1995= a(6);
inter1996= a(7);


for i = 1: row
    Newmatrix(i, col+1) = partcoeff*Newmatrix(i, col_part2)+intracoeff*Newmatrix(i, col_intraspillover2)+inter1992*Newmatrix(i, col_interspillover1992)+inter1993*Newmatrix(i, col_interspillover1993)+inter1994*Newmatrix(i, col_interspillover1994)+inter1995*Newmatrix(i, col_interspillover1995)+inter1996*Newmatrix(i, col_interspillover1996);
end


ProgramImpact = Newmatrix;

save ProgramImpact.mat ProgramImpact;
xlswrite('ProgramImpact',ProgramImpact);    
        
        